import Vue from 'vue'
import Router from 'vue-router'

import admin from '@/pages/admin/admin'
import home from '@/pages/home/home'
import login from '@/pages/login/login'
// oa
import oa from '@/pages/oa/oa'
import oaAgenda from '@/pages/oa/agenda/agenda'
import oaAgendaAgenda from '@/pages/oa/agenda/agenda/agenda'
import oaAgendaLog from '@/pages/oa/agenda/log/log'
import oaAgendaMission from '@/pages/oa/agenda/mission/mission'
import oaAgendaConference from '@/pages/oa/agenda/conference-room/conference-room'

//task
import task from '@/pages/task/task'
import allTask from '@/pages/task/allTask/allTask'
import ongoing from '@/pages/task/ongoing/ongoing'
import done from '@/pages/task/done/done'

//userInfo
import user from '@/pages/userInfo/userInfo'
import list from '@/pages/userInfo/userList/list'


//setting
const setting = () => import('../pages/setting/setting.vue')
const company = () => import('../pages/setting/companys/company.vue')
const companyChild = () => import('../pages/setting/companys/companyChild.vue')
const account = () => import('../pages/setting/account/account.vue')  //账号管理
const organization = () => import('../pages/setting/organization/organization.vue') //组织架构
const dictionary = () => import('../pages/setting/dictionary/dictionary.vue')   //字典管理
const navMenu = () => import('../pages/setting/navMenu/menu.vue')   //菜单管理
const role = () => import('../pages/setting/role/role.vue')   //岗位角色
const rolePrivilege = () => import('../pages/setting/rolePrivileges/rolePrivilege.vue')   //角色权限

//forms
import forms from '@/pages/forms/forms'
import fdetails from '@/pages/forms/fdetails/details'
import formlist from '@/pages/forms/fdetails/formlist'
import total from '@/pages/forms/fdetails/total'

Vue.use(Router)
export default new Router({
    // mode: 'history',
    routes: [{
        path: '/',
        redirect:'/login',
        name: 'admin',
        component: admin,
        children: [{
            path: '/oa',
            component: oa,
            children: [{
                path: '/oa/agenda',
                component: oaAgenda,
                children: [{
                    path: '/oa/agenda/agenda',
                    component: oaAgendaAgenda
                }, {
                    path: '/oa/agenda/log',
                    component: oaAgendaLog
                }, {
                    path: '/oa/agenda/mission',
                    component: oaAgendaMission
                }, {
                    path: '/oa/agenda/conference',
                    component: oaAgendaConference
                }]
            }]
        },
        {
            path: '/task',
            component: task,
            children: [{
                path: '/task/alltask',
                component: allTask
            },{
                path: '/task/ongoing',
                component: ongoing
            },{
                path: '/task/done',
                component: done
            }]
        },
        {
            path: '/forms',
            component: forms,
            children: [{
                path: '/forms/details',
                component: fdetails
            },{
                path: '/forms/formlist',
                component: formlist
            },{
                path: '/forms/total',
                component: total
            }]
        },
        {
            path: '/home', component: home
        },
        {
            path: '/set',
            component: setting,
            children: [
              {path: '/set/companys', component: company},
              {path: '/set/companys/:id', component: companyChild},
              {path: '/set/organ', component: organization},
              {path: '/set/account', component: account},
              {path: '/set/role', component: role},
              {path: '/set/navMenu', component: navMenu},
              {path: '/set/dictionary', component: dictionary},
              {path: '/set/rolePrivileges', component: rolePrivilege}
            ]
        },{
            path: '/user',
            component: user,
            children: [
              {path: '/user/list', component: list},
            ]
        }]
    },
    {
        path: '/login',
        name: 'login',
        component: login,
    }]
})
